﻿using Kernelx.Contexts.Core;



namespace Kernelx.Contexts.Defaults
{
    /// <summary>
    /// 
    /// </summary>
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:命名样式", Justification = "<挂起>")]
    public static class _DefaultServiceExtensions
    {
         
        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public static IJsonSerializer GetJsonSerializer(this IWorkloadContext context) => _jsonSerializer ?? (_jsonSerializer = context.GetRequiredService<IJsonSerializer>());
        private static IJsonSerializer _jsonSerializer;




        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public static ISequeGenerator GetSequeGenerator(this IWorkloadContext context) => _sequeGenerator ?? (_sequeGenerator = context.GetService<ISequeGenerator>());
        private static ISequeGenerator _sequeGenerator;

         
        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public static WorkloadEnvironment GetWorkloadEnvironment(this IWorkloadContext context) =>
            _workloadEnvironment ?? (_workloadEnvironment = context.GetRequiredService<WorkloadEnvironment>());
        private static WorkloadEnvironment _workloadEnvironment;


    }
}
